// This function processes the quiz data
function submitQuiz2()
{
	var numberCorrect = 0;
	var q1 = document.forms.quiz2.question1;
	var q2 = document.forms.quiz2.question2;
	var q3 = document.forms.quiz2.question3;
	var q4 = document.forms.quiz2.question4;
	var q5 = document.forms.quiz2.question5;
	var q6 = document.forms.quiz2.question6;
	var q7 = document.forms.quiz2.question7;
	var q8 = document.forms.quiz2.question8;
	var q9 = document.forms.quiz2.question9;
	var q10 = document.forms.quiz2.question10;
		
	if(q1[ 2 ].checked == true )
	 	{ 
		numberCorrect = numberCorrect + 1; 
		} 
	
	var q2 = document.forms.quiz2.question2; 
	if(q2[ 1 ].checked == true ) 
	    { 
		numberCorrect = numberCorrect + 1; 
		}
	
	var q3 = document.forms.quiz2.question3; 
	if(q3[ 3 ].checked == true ) 
		{
		numberCorrect = numberCorrect + 1; 
		}
	
	var q4 = document.forms.quiz2.question4; 
	if(q4[ 2 ].checked == true ) 
		{ 
		numberCorrect = numberCorrect + 1; 
		} 
		
	var q5 = document.forms.quiz2.question5; 
	if(q5[ 3 ].checked == true ) 
		{ 
		numberCorrect = numberCorrect + 1; 
		} 
	
	var q6 = document.forms.quiz2.question6; 
	if(q6[ 0 ].checked == true ) 
		{ 
		numberCorrect = numberCorrect + 1; 
		}
	
	var q7 = document.forms.quiz2.question7;
	if(q7[ 0 ].checked == true )
		 {
		 numberCorrect = numberCorrect + 1;
		 } 
		 
	var q8 = document.forms.quiz2.question8;
	 if(q8[ 2 ].checked == true ) 
	 	{ 
		numberCorrect = numberCorrect + 1; 
		} 
	
	var q9 = document.forms.quiz2.question9;
	 if(q9[ 3 ].checked == true ) 
	 	{ 
		numberCorrect = numberCorrect + 1; 
		} 
		
	var q10 = document.forms.quiz2.question10;
	 if(q10[ 1 ].checked == true ) 
	 	{ 
		numberCorrect = numberCorrect + 1; 
		} 
		
	var score = numberCorrect / 10 * 100; 
	var percentage = numberCorrect / 10; 
	
	if( score >= 70 ) 
	
	{
	alert( "Congratulations you passed the test! Your score is " + numberCorrect + " out of 10" );
	 document.getElementById( "certificate-link" ).innerHTML = " <a href='certificate.html'> Go Your Certificate</a> ";
	}
	
	  else { alert( "Almost. Try again." ); }
	
	  // call the function to report scores
		parent.reportScores( score );
}

